<?php

$sql = '[[tags]]';

$reg = '/^\[{2}(\w+)\]{2}$/i';

$re  = preg_match($reg, $sql, $match);

var_dump($re, $match);